var indexController = function controller($scope, $rootScope, $http, $log, $location, $interval, $state, $timeout, $sce, $compile) {
    hideLoader();
    $scope.curUser = getSessionJson('curUserObj');

    if(isEmpty($scope.curUser)){
        var url = 'login.html';
        location.replace(url);
    }

    $scope.logout = function () {
        if (!confirm("确定退出系统吗？")) {
            return;
        }
        $http({
            method: 'POST',
            url: 'user/loginOut',
            params: {},
            headers: {
                "Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
            }
        }).success(function (data, header, config, status) {
            var url = 'login.html';
            location.replace(url);
            removeSession('curUserObj');

        }).error(function (data, header, config, status) {
            var url = 'login.html';
            location.replace(url);
        });
    };

    // 取消，返回
    $scope.close = function () {
        history.back();
    };
};
